{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}

<div class="card" data-role="addresses-card">
  <h3 class="card-header">
    {{ 'Addresses'|trans({}, 'Admin.Global') }}
    ({{ viewableManufacturer.manufacturerAddresses|length }})
  </h3>
  <div class="card-body">
    {% if viewableManufacturer.manufacturerAddresses is not empty %}
      <table class="table">
        <thead>
          <tr>
            <th>{{ 'Name'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'Address'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'Address (2)'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'City'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'State'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'Home phone'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'Mobile phone'|trans({}, 'Admin.Global') }}</th>
            <th>{{ 'Other'|trans({}, 'Admin.Global') }}</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for address in viewableManufacturer.manufacturerAddresses %}
            <tr>
              <td>{{ address.first_name }} {{ address.last_name }}</td>
              <td>{{ address.address1 }}</td>
              <td>{{ address.address2 }}</td>
              <td>{{ address.city }}</td>
              <td>{% if address.state %}{{ address.state }}{% else %}-{% endif %}</td>
              <td>{% if address.phone %}{{ address.phone }}{% else %}-{% endif %}</td>
              <td>{% if address.phone_mobile %}{{ address.phone_mobile }}{% else %}-{% endif %}</td>
              <td>{% if address.other %}{{ address.other|nl2br }}{% else %}-{% endif %}</td>
              <td>
                <div class="btn-group-action text-right">
                  <div class="btn-group">
                    <a class="btn tooltip-link js-link-row-action dropdown-item"
                       href="{{ path('admin_manufacturer_addresses_edit', {addressId: address.id}) }}"
                       data-toggle="pstooltip"
                       data-placement="top"
                       data-original-title="{{ 'Edit'|trans({}, 'Admin.Actions') }}"
                    >
                      <i class="material-icons">edit</i>
                    </a>
                  </div>
                </div>
              </td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    {% else %}
      {{ 'No address has been found for this brand.'|trans({}, 'Admin.Catalog.Notification') }}
    {% endif %}
  </div>
</div>
